﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Power.View.Dialog;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Power.ViewModel.Dialog
{
    public class MessagePromptViewModel : ViewModelBase
    {
        private MessagePrompt model;
        public MessagePromptViewModel(string message, bool isConfirm, MessagePrompt model)
        {
            this.model = model;
            Message = message;
            CancelVis = isConfirm ? Visibility.Visible : Visibility.Collapsed;
            Close = new RelayCommand(OnClose);
            CloseOK = new RelayCommand(OnCloseOK);
        }

        private void OnCloseOK()
        {
            this.model.DialogResult = true;
            this.model.Close();
        }

        private void OnClose()
        {
            this.model.DialogResult = false;
            this.model.Close();
        }

        #region 
        public RelayCommand Close { get; private set; }
        public RelayCommand CloseOK { get; private set; }
        #endregion

        public string Message { get; private set; }

        public Visibility CancelVis { get; private set; }
    }
}
